/*
 * Copyright (c) 2013 WDCY Information Technology Co. Ltd
 * www.wdcy.cc
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * WDCY Information Technology Co. Ltd ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement you
 * entered into with WDCY Information Technology Co. Ltd.
 */
package com.monkey.web.dto.response.user;


import com.monkey.core.domain.user.UserOnlineHistory;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author Wu Tianqiang
 */
public class UserLoginHistoryJSONDto {
    private Long id;
    private Long userId;
    private String account;
    private String nick;
    private String host;
//    private String userAgent;
//    private String systemHost;
    private Date lastLoginTimestamp;
    private Date lastStopTimestamp;
    private Long totalOnlineTime;

    public UserLoginHistoryJSONDto(UserOnlineHistory userOnlineHistory) {
        this.id = userOnlineHistory.getId();
        this.userId = userOnlineHistory.getUserId();
        this.account = userOnlineHistory.getAccount();
        this.nick = userOnlineHistory.getNick();
        this.host = userOnlineHistory.getHost();
//        this.userAgent = userOnlineHistory.getUserAgent();
//        this.systemHost = userOnlineHistory.getSystemHost();
        this.lastLoginTimestamp = userOnlineHistory.getLastLoginTimestamp();
        this.lastStopTimestamp = userOnlineHistory.getLastStopTimestamp();
        this.totalOnlineTime = userOnlineHistory.getTotalOnlineTime();
    }


    public static List<UserLoginHistoryJSONDto> toJSONDto(List<UserOnlineHistory> userLoginHistories) {
        List<UserLoginHistoryJSONDto> userLoginHistoryJSONDtos = new ArrayList<>();
        for (UserOnlineHistory userOnlineHistory : userLoginHistories) {
            userLoginHistoryJSONDtos.add(new UserLoginHistoryJSONDto(userOnlineHistory));
        }
        return userLoginHistoryJSONDtos;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

//    public String getUserAgent() {
//        return userAgent;
//    }
//
//    public void setUserAgent(String userAgent) {
//        this.userAgent = userAgent;
//    }
//
//    public String getSystemHost() {
//        return systemHost;
//    }
//
//    public void setSystemHost(String systemHost) {
//        this.systemHost = systemHost;
//    }

    public Date getLastLoginTimestamp() {
        return lastLoginTimestamp;
    }

    public void setLastLoginTimestamp(Date lastLoginTimestamp) {
        this.lastLoginTimestamp = lastLoginTimestamp;
    }

    public Date getLastStopTimestamp() {
        return lastStopTimestamp;
    }

    public void setLastStopTimestamp(Date lastStopTimestamp) {
        this.lastStopTimestamp = lastStopTimestamp;
    }

    public Long getTotalOnlineTime() {
        return totalOnlineTime;
    }

    public void setTotalOnlineTime(Long totalOnlineTime) {
        this.totalOnlineTime = totalOnlineTime;
    }

}